ActivityNodeReader.Resource Property

Primary resource for the activity. For activities that do not have a resource, this returns null.

Parent Type: ActivityNodeReader

Namespace: Microsoft.LearningComponents.Manifest

Assembly: Microsoft.LearningComponents.dll

Syntax
C#

public ResourceNodeReader Resource

{ get; }
Exceptions
Exception type Condition
InvalidPackageException

The parsing mode is ManifestReaderSettings.FixScormRequirementViolations=false, and the identifierref attribute is not a valid id value, there are child <item> nodes, or there is no corresponding resource with a matching identifier.

Remarks

If there is no resource associated with this activity, this property returns null. In SCORM 2004 packages, if the activity has a resource and also has child <item> nodes, this property will throw an InvalidPackageException in ManifestReaderSettings.FixScormRequirementViolations=false.

If parsing mode is ManifestReaderSettings.FixScormRequirementViolations=true and the activity has an identifierref attribute, but no matching resource can be found, a warning is issued to the log and null is returned.

Example

Given an ActivityNodeReader, iterate through the resources for all the child activities.

C#
            foreach (ActivityNodeReader child in activity.ChildActivities)
            {
                ResourceNodeReader resource = child.Resource;
                if (resource != null)
                {
                    // Use the ResourceNodeReader
                }
            }